﻿using CoachingOrganizer.Logic.Models.Tools.MoneyCalculation;
using CoachingOrganizer.WinPhone.UITools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace CoachingOrganizer.WinPhone.ViewModels.Tools.MoneyCalculation
{
    public class OccasionalMoneyFlowItemViewModel : ViewModelBase
    {
        private readonly OccasionalMoneyFlowItemModel _model;

        public string Name
        {
            get { return _model.Name; }
            set { _model.Name = value; }
        }

        public decimal Amount
        {
            get { return _model.Amount; }
            set { _model.Amount = value; }
        }

        public DateTime Date
        {
            get { return _model.Time.Date; }
            set { _model.Time = value + _model.Time.TimeOfDay; }
        }

        public TimeSpan Time
        {
            get { return _model.Time.TimeOfDay; }
            set { _model.Time = _model.Time.Date + value; }
        }

        public ICommand RemoveCommand
        {
            get { return GetCommand(() => RemoveCommand, () => _model.Remove()); }
        }

        public OccasionalMoneyFlowItemViewModel(OccasionalMoneyFlowItemModel model)
        {
            _model = model;
        }
    }
}
